﻿using FairyGUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using WgFrame.Net;

public class LoginPanel : BasePanel
{
    private GButton btnStart;
    private GTextInput inputAccount;

    public override void Init()
    {
        base.Init();
        btnStart = view.GetChild("n2").asButton;
        inputAccount = view.GetChild("n7").asTextInput;
        btnStart.onClick.Add(OnStart);
    }

    protected override GComponent CreateView()
    {
        return UIPackage.CreateObject("Main", "panel_login").asCom;
    }

    private void OnStart(EventContext context)
    {
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            FlyTextPanelMgr.Show("账号不能为空！");
            return;
        }
        GameNetwork.ClientGuId = inputAccount.text;
        GameNetwork.Connect();
        //GameNetwork.Disconnect();
    }
}
